home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.lang.cfutures,comp.lang.c
- Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!uknet!liv!news!bruce
- From: bruce@liverpool.ac.uk (Bruce Stephens)
- Subject: Re: auto int array[n]
- In-Reply-To: lou@xilinx.com's message of Tue, 1 Mar 1994 17:17:39 GMT
- Message-ID: <BRUCE.94Mar3105536@cmsr3.liverpool.ac.uk>
- Sender: news@liverpool.ac.uk (News System)
- Nntp-Posting-Host: cmsr3.scm.liv.ac.uk
- Organization: Centre for Mathematical Software Research, Univ. Liverpool
- References: <ADK.94Feb25182210@ds4.scri.fsu.edu> <1994Mar1.171739.19872@xilinx.com>
- Date: Thu, 3 Mar 1994 10:55:36 GMT
- Lines: 27
- Xref: dd.chalmers.se alt.lang.cfutures:8 comp.lang.c:10642
-
- >>>>> On Tue, 1 Mar 1994 17:17:39 GMT, lou@xilinx.com (Lou Sanchez-Chopitea) said:
-
- > Probably because it's not needed.
-
- > void foo (int n)
- > {
- > int *pi;
-
- > pi = calloc( n, sizeof( *pi));
- > ...;
- > free( pi);
- > }
-
- That's all very well, but I still find "int pi[n]" more readable.
- More generally, it would be of great benefit to be able to write
- "double a[n][m]", where n and m are only known at runtime.
-
- Notice that C doesn't even have Fortran's facility with 2-d arrays:
- you can't write
-
- void foo(int n, double a[][n]);
-
- Fortunately, the ANSI C committee is working on it, and at least one
- compiler (GCC) supports this already (together with int pi[n]).
- --
- Bruce Institute of Advanced Scientific Computation
- bruce@liverpool.ac.uk University of Liverpool
-